package mlc.om;

import java.text.DecimalFormat;
import java.text.NumberFormat;

import mlc.Constants;
import mlc.ore.Ore;
import mlc.ore.OreProvider;


public class Ground {

	private Ore[][] grid;
	
	public Ground() {		
		grid = new Ore[Constants.groundHeightCells][Constants.groundWidthCells];
		for(int r = 0 ; r < Constants.groundHeightCells; r++)
			for(int c = 0 ; c < Constants.groundWidthCells; c++)
				grid[r][c] = OreProvider.getRandomOre(r,Constants.groundHeightCells);
	}
	
	@Override
	public String toString() {
		NumberFormat formatter = new DecimalFormat("000");
		String result = "R="+Constants.groundHeightCells+" C="+Constants.groundWidthCells+"\n";
		for(int r = 0 ; r < Constants.groundHeightCells; r++){
			result+=formatter.format(r)+"[";
			for(int c = 0 ; c < Constants.groundWidthCells; c++){
				result += grid[r][c]+" ";
			}
			result+="]\n";
		}
		return result;
	}
}
